package semana4.metodosyarrays.ejercicios;

import java.util.Arrays;
import java.util.Random;

public class Met05_OrdenarArray {

	public static void main(String[] args) {

		int[] v1 = new int[10];
		int[] v2;

		rellenarVector(v1);
		mostrarVector(v1);
		v2 = copiaOrdenada(v1);
		System.out.println();
		mostrarVector(v2);
	}

	private static int[] copiaOrdenada(int[] v1) {
		Arrays.sort(v1);
		return v1;

	}

	private static void mostrarVector(int[] v1) {
		for (int i = 0; i < v1.length; i++) {
			System.out.print(v1[i] + " ");
		}

	}

	private static void rellenarVector(int[] v1) {
		for (int i = 0; i < v1.length; i++) {
			v1[i] = (new Random().nextInt(15) + 1);
		}

	}

}
